package com.fr.report.web.ui;

import com.fr.base.StringUtils;
import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLableReader;
import com.fr.web.Repository;

public class CustomToolBarButton extends ToolBarButton
{
  private static final String XMLTAG = "CustomButton";
  private String js;

  public CustomToolBarButton()
  {
    super("", "");
  }

  public CustomToolBarButton(String paramString1, String paramString2)
  {
    super(paramString1, paramString2);
  }

  public String getJs()
  {
    return this.js;
  }

  public void setJs(String paramString)
  {
    this.js = paramString;
  }

  protected String clickAction(Repository paramRepository)
  {
    return getJs();
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    super.readXML(paramXMLableReader);
    if ((paramXMLableReader.isChildNode()) && ("CustomButton".equals(paramXMLableReader.getTagName())))
      setJs(paramXMLableReader.getElementValue());
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    super.writeXML(paramXMLPrintWriter);
    if (StringUtils.isNotBlank(this.js))
      paramXMLPrintWriter.startTAG("CustomButton").textNode(this.js).end();
  }

  public boolean equals(Object paramObject)
  {
    if ((paramObject == null) || (!(paramObject instanceof ToolBarButton)))
      return false;
    return super.equals(paramObject);
  }
}